<template>
  <!-- 推荐文章 -->
  <div
    class="hot-article-wall shadow__box"
    v-if="hotArticleList && hotArticleList.length"
  >
    <div class="article-wall__title">
      <i class="iconfont icon-redianxinwen card-content2-icon"></i>
      <span>推荐文章</span>
    </div>
    <div
      v-for="article in hotArticleList"
      :key="article.id"
      class="hot-articel-item"
      @click="goToArticleInfo(article)"
    >
      <div class="aside-post-detail flex">
        <img class="aside-post-image" v-lazy="article.thumbnail" />
        <div class="aside-post-title text--over">
          {{ article.title }}
        </div>
      </div>
      <div class="aside-post-date">
        <i class="iconfont icon-rili time-icon"></i>{{ article.createTime }}
      </div>
    </div>
  </div>
</template>
<script lang="ts" setup>
import { useArticleStore } from "@/store/article.store";
import { storeToRefs } from "pinia";
import { onMounted } from "vue";
import { useNavArticle } from "@/hooks/useNavArticle";
const { getHotArticleList } = useArticleStore();
const { hotArticleList } = storeToRefs(useArticleStore());
const { goToArticleInfo } = useNavArticle();
onMounted(() => {
  getHotArticleList();
});
</script>
<style lang="scss" scoped>
.hot-article-wall {
  padding: 25px;
  border-radius: 10px;
  margin-top: 40px;
  animation: hideToShow 1s ease-in-out;
}
.article-wall__title {
  font-size: 18px;
  margin-bottom: 20px;
}
.hot-articel-item {
  & + & {
    margin-top: 20px;
  }
}
.aside-post-image {
  border-radius: 10px;
  width: 90px;
  height: 60px;
  margin-right: 10px;
}
.aside-post-title {
  width: calc(100% - 100px);
}
.card-content2-icon {
  color: red;
  margin-right: 5px;
  animation: scale 1s ease-in-out infinite;
}

.aside-post-detail {
  display: flex;
  cursor: pointer;
}
.aside-post-date {
  font-size: 12px;
  line-height: 24px;
  .icon-rili {
    color: rgb(64, 158, 255);
    font-weight: bold;
    padding-right: 5px;
  }
}
</style>
